<template>
  <div class="dashboard-container">
    <div v-for="value in momentList" :key="value.id" class="wrapper">
      <img :src="value.cover" alt="" />
      <div class="title">{{ value.title }}</div>
      <div class="text">{{ value.content }}</div>
    </div>
  </div>
</template>

<script>
import * as momentApi from "@/api/moment";
export default {
  name: "Dashboard",
  data() {
    return {
      momentList: [],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      momentApi.getMomentList().then((res) => {
        console.log(res);
        this.momentList = res.data;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.dashboard {
  width: 100%;
  &-container {
    padding: 20px;
    display: flex;
    justify-content: space-around;
    align-content: center;
    flex-wrap: wrap;
    .wrapper {
      width: calc(50% - 40px);
      background-color: #dcf5f6;
      padding: 20px;
      margin-bottom: 30px;
      border-radius: 10px;
      &:nth-child(2n + 1) {
        margin-right: 20px;
      }
      img {
        width: 100%;
      }
      .title {
        margin-top: 10px;
        font-size: 24px;
        font-weight: 600;
      }
      .text {
        margin-top: 10px;
      }
    }
  }
}
</style>
